<template>
	<view class="clearfix">
		<view class="list">
			<view class="item" v-for="item in list" :key="item.id" @click="toResult(item.id)">
					<view>
						<view class="com_title">提现到--{{item.bankName}} <text v-if="item.bankNum">({{item.bankNum}})</text> </view>
						<view class="time">{{item.applyTime}}</view>
					</view>
					<view>
						<view class="total">-{{item.total}}</view>
						<view class="status">{{item.stateName}}</view>
					</view>
			</view>
		</view>
		<!--end  pageList-->
		 <uni-load-more :status="status" v-if="pages > 1"/>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pages:0,
				pageNo: 0,
				total: 0,
				list: [],
				queryData: {},
				status: 'more'
			};
		},
		onLoad() {
			this.getList()
		},
		onReachBottom: function() {
			let that = this;
			let pageNo = this.pageNo +1;
			let id = this.list[this.list.length-1].id;
			if(pageNo <= this.pages){
				that.queryData.pageNo = pageNo;
				that.queryData.id = id;
				that.getMoreData(that.queryData)
			}else{
				that.status = "noMore"
			}
		},
		methods:{
			getList() {
				this.$api.getExtraList({}).then(res=> {
					let resData = res.data.data.page;
					this.pages = resData.pages;
					this.pageNo = resData.current;
					this.total = resData.total;
					this.list = resData.records;
				})
			},
			//上拉刷新
			onPullDownRefresh() {
				let that = this;
				that.$api.getExtraList({}).then(res=>{
					let resData = res.data.data.page;
					that.pages = resData.pages;
					that.pageNo = resData.current;
					that.total = resData.total;
					that.list = resData.records;
					setTimeout(function() {
						uni.stopPullDownRefresh();
					}, 1000);
				}).catch(() => {
					setTimeout(function() {
						uni.stopPullDownRefresh();
					}, 1000);
				})
			},
			//获取更多
			getMoreData(reQuery) {
				this.$api.getExtraList(reQuery).then(res=>{
					let data = res.data.data.page;
					if(data){
						this.pages = resData.pages;
						this.pageNo = resData.current;
						this.total = resData.total;
						this.list = this.list.concat(resData.records);
					}
				})
			},
			//去结果页面，
			toResult(id){
				uni.navigateTo({
					url: "/pages/user/inside/widthResult?id=" + id +"&show=false"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	
	.list{margin: 20rpx 30rpx;
		.item{display: flex;justify-content: space-between;border-bottom: 2rpx solid #eee;padding: 32rpx 0 ;}
		.time,.status{margin-top: 20rpx;}
		.time{font-size: 24rpx;color: #999;}
		.total{font-size: 40rpx;font-weight: bold;color: #333;}
		.status{font-size: 24rpx; color:#FC4073}
	}

</style>
